package com.tuu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuu.pojo.JwtUser;
import com.tuu.pojo.Permission;
import com.tuu.pojo.RPVersion;
import com.tuu.pojo.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
@Service
public interface JwtUserMapper extends BaseMapper<JwtUser> {
    //第一个sql为获取用户所拥有角色
    @Select("select * from  role where id in(select role_id from user_role where user_id = #{uid})")
    Set<Role> getUserRoles(@Param("uid") Long uid);
    Set<Permission> getUserAuths(@Param("uid") Long uid);
    @Select("select * from permission")
    HashSet<Permission> findAllPermissons();
    @Select("select * from version")
    ArrayList<RPVersion> findVersion();
}